(function($) {
		$(function() {
			$('#myDropdown').empty(); // empty the drop down (if necessarry)
			$('#myDropdown').append('<option selected></option>');
		    $(titles).each(function(iIndex, sElement) {
		        $('#myDropdown').append('<option>' + sElement + '</option>');
		    });
			
			$('select').selectToAutocomplete();
			 $( "#tags" ).autocomplete({
    		  source: titles
   			 });
   			 
   			 $("#getdetails").click(function() {
   				 
 				 if ($("#chbox").is(":checked")) {
 					 alert("Your Selection Via Exact Search : " + $("#tags").val());
 				 } else {
 				 	alert("Your Selection : " + $("#myDropdown").val());
 				 }
 				
 			 });
				
			$("#myinput").hide();
			
		$("#chbox").change(function(){
        if($(this).attr("checked"))
        {
            //call the function to be fired
            //when your box changes from
            //unchecked to checked
            $("#myinput").show();
            $("#myselect").hide();
             $("#tags").val('');
        }
        else
        {
            //call the function to be fired
            //when your box changes from
            //checked to unchecked
            $("#myinput").hide();
            $("#myselect").show();
            //$("#myDropdown").val('');
            //$('#myDropdown option:eq(0)').attr('selected','selected');
           

        }
    });
			
			
		});
	})(jQuery);